package com.qf.pojo;

import java.util.List;

/**
 * 自定义的分页实体
 */
public class PageBean<T> {
    //5个属性
    private int currentPage ; //当前页码
    private int pageSize    ; //每页显示的条数
    private int totalPage   ; //总页数 //计算出来的,查询到总记录数 除以 pageSize
    private int totalCount  ; // 总记录数
    private List<T> pageList ; //分页查询的列表数据


    public PageBean() {
    }

    public PageBean(int currentPage, int pageSize, int totalCount, List<T> pageList) {
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.pageList = pageList;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    //总页数计算出来
    public int getTotalPage() {
        return  ((totalCount % pageSize == 0)?(totalCount/pageSize):(totalCount/pageSize)+1);
    }

   /* public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }*/

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public List<T> getPageList() {
        return pageList;
    }

    public void setPageList(List<T> pageList) {
        this.pageList = pageList;
    }

    @Override
    public String toString() {
        return "PageBean{" +
                "currentPage=" + currentPage +
                ", pageSize=" + pageSize +
                ", totalCount=" + totalCount +
                ", pageList=" + pageList +
                '}';
    }
}
